//
//  IntroductionsView.m
//  Civacrm
//
//  Created by zhk on 2017/2/22.
//  Copyright © 2017年 王桂敏. All rights reserved.
//

#import "IntroductionsView.h"

@implementation IntroductionsView

- (void)creatView
{
    _alphaHalfView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    _alphaHalfView.backgroundColor = [UIColor blackColor];
    _alphaHalfView.alpha = 0.5;
    
    _bgView = [[UIView alloc]initWithFrame:CGRectMake(40, 150 * SizeZoom, kScreenWidth - 80, 250)];
    _bgView.backgroundColor = [UIColor whiteColor];
    _bgView.layer.masksToBounds = YES;
    _bgView.layer.cornerRadius = 10;
    
    _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 5, kScreenWidth - 80 - 20, 35)];
    _titleLabel.textColor = ColorWithHexString(@"4e778f");
    _titleLabel.text = @"执行力日排行榜说明";
    _titleLabel.numberOfLines = 0;
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    _titleLabel.font = font(30);
    
    
    _contentView = [[UITextView alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(self.titleLabel.frame) + 10, kScreenWidth - 80 -40, CGRectGetHeight(self.bgView.frame) - CGRectGetHeight(self.titleLabel.frame) - 50)];
    _contentView.textColor = ColorWithHexString(@"4e778f");
    _contentView.editable = NO;
    _contentView.textAlignment = NSTextAlignmentLeft;
    _contentView.font = font(28);
    
    _btn = [[UIButton alloc]initWithFrame:CGRectMake(kScreenWidth / 2 - 20, CGRectGetMaxY(self.bgView.frame) + 30, 40, 40)];
    [_btn setImage:Image(@"icon_guanbi2") forState:(UIControlStateNormal)];
    [_btn addTarget:self action:@selector(removeView) forControlEvents:(UIControlEventTouchUpInside)];
    
    
    [[UIApplication sharedApplication].keyWindow addSubview:self.alphaHalfView];
    [[UIApplication sharedApplication].keyWindow addSubview:self.bgView];
    [self.bgView addSubview:self.titleLabel];
    [self.bgView addSubview:self.contentView];
    [[UIApplication sharedApplication].keyWindow addSubview:self.btn];
    
    
}

- (void)removeView
{
    [self.alphaHalfView removeFromSuperview];
    [self.bgView removeFromSuperview];
    [self.titleLabel removeFromSuperview];
    [self.contentView removeFromSuperview];
    [self.btn removeFromSuperview];
    [self removeFromSuperview];
}


@end
